<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
    <title>代理商管理系统</title>
    <link rel="stylesheet" type="text/css" href="${ctx}/statics/easyui/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/statics/easyui/themes/icon.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/statics/easyui/themes/color.css" />
    <link rel="stylesheet" type="text/css" href="${ctx}/statics/easyui/themes/demo.css" />
    <script src="${ctx}/statics/easyui/jquery.min.js" type="text/javascript"></script>
    <script src="${ctx}/statics/easyui/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="${ctx}/statics/easyui/easyui-lang-zh_CN.js" type="text/javascript"></script>
</head>
<body class="easyui-layout" >
    <div id="tool" data-options="region:'north',border:false" style="width:100%;height:50px;line-height:50px;background:#eee;text-align:center">
        <span style="font-size:13px">操作时间:</span>
        <input class="easyui-datetimebox" id="start"
               data-options="showSeconds:true" style="width:150px;height:24px">
        <span style="font-size:13px">至:</span>
        <input class="easyui-datetimebox" id="end"
               data-options="showSeconds:true" style="width:150px;height:24px;">
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
           id="find" style="width:80px;height:24px">查询</a>
        <a href="${ctx}/do/downloadExcel?excelType=agentBalanceExcel" class="easyui-linkbutton" style="width:80px;height:24px" >下载报表</a>

    </div>
    <div data-options="region:'center',border:false" style="width:100%;" >
        <table id="agentBalanceDg" style="width:100%;"></table>
    </div>

    <script>
        $(
            function ()
            {
                var agentBalanceDg = $("#agentBalanceDg").datagrid(
                    {
                        url:'${ctx}/do/showAgentBalanceReportPage',
                        singleSelect:true,
                        fitColumns:true,
                        striped:true,
                        fit:true,
                        rownumbers:true,
                        pagination:true, //增加分页工具栏
                        pageNumber:1, //设置初始化页码
                        pageSize:10,  //页大小
                        pageList:[5,10,15], //显示数量选择
                        columns:
                            [
                                [
                                    {field:'id',title:'序号',width:'5%',align:'center'},
                                    {field:'userName',title:'代理商名称',width:'10%',align:'center'},
                                    {field:'money',title:'账务资金',width:'9%',align:'center'},
                                    {field:'accountMoney',title:'账户余额',width:'9%',align:'center'},
                                    {field:'memo',title:'备注信息',width:'50%',align:'center'},
                                    {field:'detailDateTime',title:'交易时间',width:'15%',align:'center'}
                                ]
                            ]
                    });

                //页面加载为查询按钮注册事件
                $("#find").linkbutton(
                    {
                        onClick:function()
                        {
                            //获取时间段
                            var start = $("#start").datetimebox('getValue');
                            //(默认获取为string类型)不输入查询时间时将该值转换为null
                            var end = $("#end").datetimebox('getValue');
                            if( start != "" && end != "" )
                            {
                                //加入请求参数
                                agentBalanceDg.datagrid(
                                    {
                                        queryParams:{"start":start,"end":end}
                                    }
                                );
                            }
                            else
                            {
                                agentBalanceDg.datagrid(
                                    {
                                        queryParams:{}
                                    }
                                );
                            }
                        }
                    }
                );
            }
        );
    </script>
</body>
</html>
